/*
 * Copyright (c) 2018. paascloud.net All Rights Reserved.
 * 项目名称：paascloud快速搭建企业级分布式微服务平台
 * 类名称：UacMenuService.java
 * 创建人：刘兆明
 * 联系方式：paascloud.net@gmail.com
 * 开源地址: https://github.com/paascloud
 * 博客地址: http://blog.paascloud.net
 * 项目官网: http://paascloud.net
 */

package com.csun.cmny.provider.service;


import com.csun.cmny.base.dto.LoginAuthDto;
import com.csun.cmny.core.support.IService;
import com.csun.cmny.provider.model.domain.UacAction;
import com.csun.cmny.provider.model.domain.UacMenu;
import com.csun.cmny.provider.model.dto.menu.UacMenuCheckCodeDto;
import com.csun.cmny.provider.model.dto.menu.UacMenuCheckUrlDto;
import com.csun.cmny.provider.model.dto.menu.UacMenuStatusDto;
import com.csun.cmny.provider.model.dto.menu.MenuQueryDto;
import com.csun.cmny.provider.model.vo.BindAuthVo;
import com.csun.cmny.provider.model.vo.MenuVo;
import com.csun.cmny.provider.model.vo.ViewMenuVo;
import com.github.pagehelper.PageInfo;

import java.util.List;
import java.util.Set;


/**
 * The interface Uac menu service.
 *
 * @author paascloud.net @gmail.com
 */
public interface UacMenuService extends IService<UacMenu> {
	/**
	 * Gets menu vo list by user id.
	 *
	 * @param userId        the user id
	 * @param applicationId the application id
	 *
	 * @return the menu vo list by user id
	 */
	List<MenuVo> getMenuVoList(Long userId, Long applicationId);

	/**
	 * Save uac menu int.
	 *
	 * @param uacMenu      the uac menu
	 * @param loginAuthDto the login auth dto
	 *
	 * @return the int
	 */
	int saveUacMenu(UacMenu uacMenu, LoginAuthDto loginAuthDto);

	/**
	 * Delete uac menu by id int.
	 *
	 * @param id           the id
	 * @param loginAuthDto the login auth dto
	 *
	 * @return the int
	 */
	int deleteUacMenuById(Long id, LoginAuthDto loginAuthDto);

	/**
	 * Enable menu list int.
	 *
	 * @param menuList     the menu list
	 * @param loginAuthDto the login auth dto
	 *
	 * @return the int
	 */
	int enableMenuList(List<UacMenu> menuList, LoginAuthDto loginAuthDto);

	/**
	 * Gets all parent menu by menu id.
	 *
	 * @param id the id
	 *
	 * @return the all parent menu by menu id
	 */
	List<UacMenu> getAllParentMenuByMenuId(Long id);

	/**
	 * Gets all child menu by menu id.
	 *
	 * @param id   the id
	 * @param type the type
	 *
	 * @return the all child menu by menu id
	 */
	List<UacMenu> getAllChildMenuByMenuId(Long id, String type);

	/**
	 * Disable menu list int.
	 *
	 * @param menuList     the menu list
	 * @param loginAuthDto the login auth dto
	 *
	 * @return the int
	 */
	int disableMenuList(List<UacMenu> menuList, LoginAuthDto loginAuthDto);

	/**
	 * Select menu list list.
	 *
	 * @param cusUacMenu the cus uac menu
	 *
	 * @return the list
	 */
	List<UacMenu> selectMenuList(UacMenu cusUacMenu);

	/**
	 * Find all menu list by auth res dto list.
	 *
	 * @param authResDto the auth res dto
	 *
	 * @return the list
	 */
	List<MenuVo> findAllMenuListByAuthResDto(LoginAuthDto authResDto);

	/**
	 * Gets vo by id.
	 *
	 * @param id the id
	 *
	 * @return the vo by id
	 */
	ViewMenuVo getViewVoById(Long id);

	/**
	 * Update uac menu status by id.
	 *
	 * @param uacMenuStatusDto the uac menu status dto
	 * @param loginAuthDto     the login auth dto
	 */
	void updateUacMenuStatusById(UacMenuStatusDto uacMenuStatusDto, LoginAuthDto loginAuthDto);

	/**
	 * 判断菜单是否有子菜单.
	 *
	 * @param menuId the menu id
	 *
	 * @return the boolean
	 */
	boolean checkMenuHasChildMenu(Long menuId);

	/**
	 * 根据角色ID查询菜单列表.
	 *
	 * @param roleId the role id
	 *
	 * @return the list
	 */
	List<UacMenu> listMenuListByRoleId(Long roleId);

	/**
	 * Gets menu list.
	 *
	 * @param menuIdList the menu id list
	 *
	 * @return the menu list
	 */
	List<UacMenu> getMenuList(Set<Long> menuIdList);

	/**
	 * 校验菜单编码是否唯一
	 *
	 * @param uacMenuCheckCodeDto	the uac menu check code dto
	 *
	 * @return	the boolean, true-不存在  false-已存在
	 */
    boolean checkUacMenuCode(UacMenuCheckCodeDto uacMenuCheckCodeDto);

	/**
	 * 校验菜单url是否唯一
	 *
	 * @param uacMenuCheckUrlDto	the uac menu check url dto
	 *
	 * @return	the boolean, true-不存在  false-已存在
	 */
	boolean checkUacMenuUrl(UacMenuCheckUrlDto uacMenuCheckUrlDto);

	/**
	 * 修改菜单信息
	 *
	 * @param uacMenu		the uac menu
	 * @param loginAuthDto	the login auth dto
	 *
	 * @return	the int
	 */
    Integer editUacMenu(UacMenu uacMenu, LoginAuthDto loginAuthDto);

	/**
	 * 查询菜单及下面所有子菜单
	 *
	 * @param menuQueryDto
	 * @return
	 */
	List<UacMenu> queryMenuAndSubMenuListWithPage(MenuQueryDto menuQueryDto);

	/**
	 * 查询角色菜单列表
	 *
	 * @param menuQueryDto role menu query dto
	 *
	 * @return the page info.
	 */
    List<UacMenu> queryRoleMenuListWithPage(MenuQueryDto menuQueryDto);

	/**
	 * 查询菜单列表
	 *
	 * @param menuQueryDto	the menu query dto
	 *
	 * @return	the list.
	 */
	List<UacMenu> queryMenuList(MenuQueryDto menuQueryDto);

	/**
	 * 查询菜单Id及所有的子菜单Id
	 *
	 * @param menuId	待查询的菜单Id
	 *
	 * @return	查询出来的菜单及子菜单Id 用,隔开
	 */
    List<Long> queryMenuAndSubMenuIds(Long menuId);

	/**
	 * 查询菜单Id及所有的子菜单Id
	 *
	 * @param menuId
	 * @param menuIdList
	 *
	 * @return
	 */
	List<Long> queryMenuAndSubMenuIdsInMenuList(Long menuId, List<Long> menuIdList);

	/**
	 * 根据菜单Id列表生成菜单树
	 *
	 * @param menuIdList	the menu id list
	 *
	 * @return	the bind auth vo
	 */
	BindAuthVo getMenuTreeByMenuIdList(List<Long> menuIdList);

	/**
	 * 生成列表
	 *
	 * @param uacMenus		the uac menu list
	 * @param uacActions	the uac action list
	 *
	 * @return	the list
	 */
	List<MenuVo> getAuthList(List<UacMenu> uacMenus, List<UacAction> uacActions);
}
